<{extends file="$elementPath/layout/index.html"}>
<{block name='body'}>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">操作日志</div>
                <div class="layui-card-body">
                    <table class="layui-hide" id="table-page" lay-filter="table-action"></table>
                    <script type="text/html" id="table-action">
                        <a class="layui-btn layui-btn-xs" lay-event="profile">详情</a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    layui.use(['index', 'table'], function () {
        var table = layui.table;
        table.render({
            elem: '#table-page'
            , url: '/<{$module}>/<{$controller}>/index?do=list'
            , limit: 30
            , height: 'full-95'//无搜索条件
            , cols: [[
                {field: 'id', width: 80, title: 'ID', sort: true}
                , {field: 'username', width: 150, title: '用户名'}
                , {field: 'title', width: 150, title: '操作标题'}
                , {field: 'uri', title: '操作地址'}
                , {field: 'time', title: '操作时间'}
                , {width: 180, align: 'center', toolbar: '#table-action'}
            ]]
            , page: true
        });

        var $ = layui.$, active = {
            profile: function (obj) { //获取选中数据
                var data = obj.data;
                layer.open({
                    type: 2
                    , title: '操作日志详情'
                    , content: '/<{$module}>/<{$controller}>/profile?id=' + data.id
                    , maxmin: true
                    , area: ['60%', '90%']
                    , btn: ['关闭']
                });
            }
        };
        //监听工具条
        table.on('tool(table-action)', function (obj) {
            var type = obj.event;
            active[type] ? active[type].call(this, obj) : '';
        });
    });
</script>
<{/block}>